import { defineConfig } from 'vite';

export default defineConfig({
  resolve: {
    alias: {
      moment: 'moment',
      'API': '/plugins/@cloud-monitor/web/src/client/components/API'
    },
  },
  build: {
    rollupOptions: {
      output: {
        manualChunks: {
          'react': ['react', 'react-dom', 'react-dates', 'react-hook-form'],
          'echarts': ['echarts'],
          'antd': ['antd'],
          'moment': ['moment'],
          'kuiper': [
            './plugins/@kuiper/react-base/src/client',
            './plugins/@kuiper/graphql/src/client',
            './plugins/@kuiper/auth/src/client',
            './plugins/@kuiper/notification/src/client',
          ],
          'cloud-monitor': ['./plugins/@cloud-monitor/web/src/client']
        }
      }
    },
    minify: 'terser',
    sourcemap: false,
    terserOptions: {
      compress: {
        // 生产环境时移除console
        drop_console: true,
        drop_debugger: true,
      },
    },
  }
});
